<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  // ["1242", "45", "6124", "6", "4", "3545"]
  var str = "ag1242ddg45g6124f6h4f3545g";
  var arr = str.match( /\d+/g );
  console.log(arr);



  
</script>
</html>